import {axios} from '@/utils/request'

// api接口列表
const api = {
    byId: '/pay/order/{id}',
    byOrderNo: '/pay/order/orderNo/{orderNo}',
    detail: '/pay/order/detail/{id}',
    page: '/pay/order/page',
    submitOrder: '/pay/order/submit',
}

export function page(params) {
    return axios({
        url: api.page,
        method: 'get',
        params
    })
}

export function byId(id, sync) {
    return axios({
        url: api.byId.replace('{id}', id),
        method: 'get',
        params: {sync: sync}
    })
}

export function byOrderNo(orderNo, sync) {
    return axios({
        url: api.byOrderNo.replace('{orderNo}', orderNo),
        method: 'get',
        params: {sync: sync}
    })
}

export function detail(id) {
    return axios({
        url: api.detail.replace('{id}', id),
        method: 'get'
    })
}

export function submitOrder(data) {
    return axios({
        url: api.submitOrder,
        method: 'post',
        data
    })
}
